package system

import (
	"server/common/dto/response"
	"server/core"
	"server/service/dto/request"
	"server/service/v1/system"

	"github.com/gin-gonic/gin"
)

type RoleMenuHandler struct {
	RoleMenuService system.RoleMenuService
}

func NewRoleMenuHandlerApp(service *system.RoleMenuService) *RoleMenuHandler {
	return &RoleMenuHandler{
		RoleMenuService: *service,
	}
}

// @Summary 创建角色菜单信息
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Param data body request.CreateRoleMenuRequest true "创建角色菜单信息请求参数"
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/create [post]
func (rmh *RoleMenuHandler) CreateRoleMenuInfoHandler(ctx *gin.Context) {
	var createRequest request.CreateRoleMenuRequest
	if !core.ValidateParams(ctx, &createRequest) {
		return
	}
	responseData, err := rmh.RoleMenuService.CreateRoleMenuInfoService(&createRequest)
	if err != nil {
		response.FailedWithCode(ctx, err.Code)
		return
	}
	response.Success(ctx, responseData)
}

// @Summary 删除角色菜单信息
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Param id path string true "删除角色菜单信息请求参数"
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/delete/{id} [delete]
func (rmh *RoleMenuHandler) DeleteRoleMenuInfoHandler(ctx *gin.Context) {
	id := ctx.Param("id")
	if !core.ValidateParams(ctx, &id) {
		return
	}
	responseData, err := rmh.RoleMenuService.DeleteRoleMenuInfoService(id)
	if err != nil {
		response.FailedWithCode(ctx, err.Code)
		return
	}
	response.Success(ctx, responseData)
}

// @Summary 修改角色菜单信息
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/modify [put]
func (rmh *RoleMenuHandler) ModifyRoleMenuInfoHandler(ctx *gin.Context) {

}

// @Summary 获取角色菜单详情
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Param id path string true "获取角色菜单详情请求参数"
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/info/{id} [get]
func (rmh *RoleMenuHandler) GetRoleMenuInfoHandler(ctx *gin.Context) {

}

// @Summary 获取角色菜单列表
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Param name query string true "角色菜单名称"
// @Param code query string true "角色菜单代码"
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/list [get]
func (rmh *RoleMenuHandler) GetRoleMenuListHandler(ctx *gin.Context) {

}

// @Summary 获取角色菜单分页列表
// @Tags 角色菜单管理
// @Accept json
// @Produce json
// @Param page query int true "页码"
// @Param size query int true "每页大小"
// @Param name query string true "角色菜单名称"
// @Param code query string true "角色菜单代码"
// @Success 200 {object} response.Response "成功"
// @Failure 400 {object} response.Response "失败"
// @Router /api/v1/role_menu/page [get]
func (rmh *RoleMenuHandler) GetRoleMenuPageHandler(ctx *gin.Context) {

}
